
 
package com.junitUtil.listener;	
import org.springframework.test.context.TestContext;
import org.springframework.test.context.support.AbstractTestExecutionListener;

import com.junitUtil.spring.DecoratorBeanFactory;



/**
 * 单测的自定义listener
 * 用于将单测的实例放到spring的beanfactory中，用于aop的部分代码去实现mock相关功能
 * 
 **/
public class MockTestExecutionListeners extends AbstractTestExecutionListener  {
    @Override
    public void prepareTestInstance(TestContext testContext) throws Exception {
        DecoratorBeanFactory.getInstance().registerSingleton(DecoratorBeanFactory.JUNIT_TEST_NAME, testContext.getTestInstance());
     }
}

